Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Conversation

@kylorhall
Copy link
Owner

A very generic 30m example for how to use a react-router-dom and useContext with some API calls.

  • Navigates across routes by reading a persisted state with some brief loading + error state (probably could be centralized and checked above the router).
  • Treated as a sub-router; /users/:userId and /books/:bookId would work just fine with a slightly amended parent router.
  • Can delete a user (API and local state).
  • Can restore the user via an optional location.state.deletedUser (eg. a nice-to-have, but not a requirement if the user does lose this location state). Similarly, checks if the user can still be restored incase the location.state has leaked..
  • Can force refresh the list of Users.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants